home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / gnu / termcap.lha / termcap-1.2 / termcap.info-2 (.txt) < prev    next >
GNU Info File  |  1993-04-14  |  44KB  |  707 lines

  1. This is Info file /home/gd/gnu/termcap/termcap.info, produced by
  2. Makeinfo-1.52 from the input file /home/gd/gnu/termcap/termcap.texi.
  3.    This file documents the termcap library of the GNU system.
  4.    Copyright (C) 1988 Free Software Foundation, Inc.
  5.    Permission is granted to make and distribute verbatim copies of this
  6. manual provided the copyright notice and this permission notice are
  7. preserved on all copies.
  8.    Permission is granted to copy and distribute modified versions of
  9. this manual under the conditions for verbatim copying, provided that
  10. the entire resulting derived work is distributed under the terms of a
  11. permission notice identical to this one.
  12.    Permission is granted to copy and distribute translations of this
  13. manual into another language, under the above conditions for modified
  14. versions, except that this permission notice may be stated in a
  15. translation approved by the Foundation.
  16. File: termcap.info,  Node: Naming,  Next: Inheriting,  Prev: Capability Format,  Up: Data Base
  17. Terminal Type Name Conventions
  18. ==============================
  19.    There are conventions for choosing names of terminal types.  For one
  20. thing, all letters should be in lower case.  The terminal type for a
  21. terminal in its most usual or most fundamental mode of operation should
  22. not have a hyphen in it.
  23.    If the same terminal has other modes of operation which require
  24. different terminal descriptions, these variant descriptions are given
  25. names made by adding suffixes with hyphens.  Such alternate descriptions
  26. are used for two reasons:
  27.    * When the terminal has a switch that changes its behavior.  Since
  28.      the computer cannot tell how the switch is set, the user must tell
  29.      the computer by choosing the appropriate terminal type name.
  30.      For example, the VT-100 has a setup flag that controls whether the
  31.      cursor wraps at the right margin.  If this flag is set to "wrap",
  32.      you must use the terminal type `vt100-am'.  Otherwise you must use
  33.      `vt100-nam'.  Plain `vt100' is defined as a synonym for either
  34.      `vt100-am' or `vt100-nam' depending on the preferences of the
  35.      local site.
  36.      The standard suffix `-am' stands for "automatic margins".
  37.    * To give the user a choice in how to use the terminal.  This is done
  38.      when the terminal has a switch that the computer normally controls.
  39.      For example, the Ann Arbor Ambassador can be configured with many
  40.      screen sizes ranging from 20 to 60 lines.  Fewer lines make bigger
  41.      characters but more lines let you see more of what you are editing.
  42.      As a result, users have different preferences.  Therefore, termcap
  43.      provides terminal types for many screen sizes.  If you choose type
  44.      `aaa-30', the terminal will be configured to use 30 lines; if you
  45.      choose `aaa-48', 48 lines will be used, and so on.
  46.    Here is a list of standard suffixes and their conventional meanings:
  47.      Short for "wide".  This is a mode that gives the terminal more
  48.      columns than usual.  This is normally a user option.
  49. `-am'
  50.      "Automatic margins".  This is an alternate description for use when
  51.      the terminal's margin-wrap switch is on; it contains the `am'
  52.      flag.  The implication is that normally the switch is off and the
  53.      usual description for the terminal says that the switch is off.
  54. `-nam'
  55.      "No automatic margins".  The opposite of `-am', this names an
  56.      alternative description which lacks the `am' flag.  This implies
  57.      that the terminal is normally operated with the margin-wrap switch
  58.      turned on, and the normal description of the terminal says so.
  59. `-na'
  60.      "No arrows".  This terminal description initializes the terminal to
  61.      keep its arrow keys in local mode.  This is a user option.
  62. `-rv'
  63.      "Reverse video".  This terminal description causes text output for
  64.      normal video to appear as reverse, and text output for reverse
  65.      video to come out as normal.  Often this description differs from
  66.      the usual one by interchanging the two strings which turn reverse
  67.      video on and off.
  68.      This is a user option; you can choose either the "reverse video"
  69.      variant terminal type or the normal terminal type, and termcap will
  70.      obey.
  71.      "Status".  Says to enable use of a status line which ordinary
  72.      output does not touch (*note Status Line::.).
  73.      Some terminals have a special line that is used only as a status
  74.      line.  For these terminals, there is no need for an `-s' variant;
  75.      the status line commands should be defined by default.  On other
  76.      terminals, enabling a status line means removing one screen line
  77.      from ordinary use and reducing the effective screen height.  For
  78.      these terminals, the user can choose the `-s' variant type to
  79.      request use of a status line.
  80. `-NLINES'
  81.      Says to operate with NLINES lines on the screen, for terminals
  82.      such as the Ambassador which provide this as an option.  Normally
  83.      this is a user option; by choosing the terminal type, you control
  84.      how many lines termcap will use.
  85. `-NPAGESp'
  86.      Says that the terminal has NPAGES pages worth of screen memory,
  87.      for terminals where this is a hardware option.
  88. `-unk'
  89.      Says that description is not for direct use, but only for
  90.      reference in `tc' capabilities.  Such a description is a kind of
  91.      subroutine, because it describes the common characteristics of
  92.      several variant descriptions that would use other suffixes in
  93.      place of `-unk'.
  94. File: termcap.info,  Node: Inheriting,  Next: Changing,  Prev: Naming,  Up: Data Base
  95. Inheriting from Related Descriptions
  96. ====================================
  97.    When two terminal descriptions are similar, their identical parts do
  98. not need to be given twice.  Instead, one of the two can be defined in
  99. terms of the other, using the `tc' capability.  We say that one
  100. description "refers to" the other, or "inherits from" the other.
  101.    The `tc' capability must be the last one in the terminal description,
  102. and its value is a string which is the name of another terminal type
  103. which is referred to.  For example,
  104.      N9|aaa|ambassador|aaa-30|ann arbor ambassador/30 lines:\
  105.              :ti=\E[2J\E[30;0;0;30p:\
  106.              :te=\E[60;0;0;30p\E[30;1H\E[J:\
  107.              :li#30:tc=aaa-unk:
  108. defines the terminal type `aaa-30' (also known as plain `aaa') in terms
  109. of `aaa-unk', which defines everything about the Ambassador that is
  110. independent of screen height.  The types `aaa-36', `aaa-48' and so on
  111. for other screen heights are likewise defined to inherit from `aaa-unk'.
  112.    The capabilities overridden by `aaa-30' include `li', which says how
  113. many lines there are, and `ti' and `te', which configure the terminal
  114. to use that many lines.
  115.    The effective terminal description for type `aaa' consists of the
  116. text shown above followed by the text of the description of `aaa-unk'.
  117. The `tc' capability is handled automatically by `tgetent', which finds
  118. the description thus referenced and combines the two descriptions
  119. (*note Find::.).  Therefore, only the implementor of the terminal
  120. descriptions needs to think about using `tc'.  Users and application
  121. programmers do not need to be concerned with it.
  122.    Since the reference terminal description is used last, capabilities
  123. specified in the referring description override any specifications of
  124. the same capabilities in the reference description.
  125.    The referring description can cancel out a capability without
  126. specifying any new value for it by means of a special trick.  Write the
  127. capability in the referring description, with the character `@' after
  128. the capability name, as follows:
  129.      NZ|aaa-30-nam|ann arbor ambassador/30 lines/no automatic-margins:\
  130.              :am@:tc=aaa-30:
  131. File: termcap.info,  Node: Changing,  Prev: Inheriting,  Up: Data Base
  132. When Changes in the Data Base Take Effect
  133. =========================================
  134.    Each application program must read the terminal description from the
  135. data base, so a change in the data base is effective for all jobs
  136. started after the change is made.
  137.    The change will usually have no effect on a job that have been in
  138. existence since before the change. The program probably read the
  139. terminal description once, when it was started, and is continuing to
  140. use what it read then.  If the program does not have a feature for
  141. reexamining the data base, then you will need to run it again (probably
  142. killing the old job).
  143.    If the description in use is coming from the `TERMCAP' environment
  144. variable, then the data base file is effectively overridden, and
  145. changes in it will have no effect until you change the `TERMCAP'
  146. variable as well.  For example, some users' `.login' files
  147. automatically copy the terminal description into `TERMCAP' to speed
  148. startup of applications.  If you have done this, you will need to
  149. change the `TERMCAP' variable to make the changed data base take effect.
  150. File: termcap.info,  Node: Capabilities,  Next: Summary,  Prev: Data Base,  Up: Top
  151. Definitions of the Terminal Capabilities
  152. ****************************************
  153.    This section is divided into many subsections, each for one aspect of
  154. use of display terminals.  For writing a display program, you usually
  155. need only check the subsections for the operations you want to use.
  156. For writing a terminal description, you must read each subsection and
  157. fill in the capabilities described there.
  158.    String capabilities that are display commands may require numeric
  159. parameters (*note Parameters::.).  Most such capabilities do not use
  160. parameters.  When a capability requires parameters, this is explicitly
  161. stated at the beginning of its definition.  In simple cases, the first
  162. or second sentence of the definition mentions all the parameters, in
  163. the order they should be given, using a name in upper case for each
  164. one.  For example, the `rp' capability is a command that requires two
  165. parameters; its definition begins as follows:
  166.      String of commands to output a graphic character C, repeated N
  167.      times.
  168.    In complex cases or when there are many parameters, they are
  169. described explicitly.
  170.    When a capability is described as obsolete, this means that programs
  171. should not be written to look for it, but terminal descriptions should
  172. still be written to provide it.
  173.    When a capability is described as very obsolete, this means that it
  174. should be omitted from terminal descriptions as well.
  175. * Menu:
  176. * Basic::       Basic characteristics.
  177. * Screen Size::  Screen size, and what happens when it changes.
  178. * Cursor Motion::  Various ways to move the cursor.
  179. * Wrapping::    What happens if you write a character in the last column.
  180. * Scrolling::   Pushing text up and down on the screen.
  181. * Windows::     Limiting the part of the window that output affects.
  182. * Clearing::    Erasing one or many lines.
  183. * Insdel Line::  Making new blank lines in mid-screen; deleting lines.
  184. * Insdel Char::  Inserting and deleting characters within a line.
  185. * Standout::    Highlighting some of the text.
  186. * Underlining::  Underlining some of the text.
  187. * Cursor Visibility::  Making the cursor more or less easy to spot.
  188. * Bell::        Attracts user's attention; not localized on the screen.
  189. * Keypad::      Recognizing when function keys or arrows are typed.
  190. * Meta Key::    META acts like an extra shift key.
  191. * Initialization::  Commands used to initialize or reset the terminal.
  192. * Pad Specs::   Info for the kernel on how much padding is needed.
  193. * Status Line::  A status line displays "background" information.
  194. * Half-Line::   Moving by half-lines, for superscripts and subscripts.
  195. * Printer::     Controlling auxiliary printers of display terminals.
  196. File: termcap.info,  Node: Basic,  Next: Screen Size,  Up: Capabilities
  197. Basic Characteristics
  198. =====================
  199.    This section documents the capabilities that describe the basic and
  200. nature of the terminal, and also those that are relevant to the output
  201. of graphic characters.
  202.      Flag whose presence means that the terminal can overstrike.  This
  203.      means that outputting a graphic character does not erase whatever
  204.      was present in the same character position before.  The terminals
  205.      that can overstrike include printing terminals, storage tubes (all
  206.      obsolete nowadays), and many bit-map displays.
  207.      Flag whose presence means that outputting a space erases a
  208.      character position even if the terminal supports overstriking.  If
  209.      this flag is not present and overstriking is supported, output of
  210.      a space has no effect except to move the cursor.
  211.      (On terminals that do not support overstriking, you can always
  212.      assume that outputting a space at a position erases whatever
  213.      character was previously displayed there.)
  214.      Flag whose presence means that this terminal type is a generic type
  215.      which does not really describe any particular terminal.  Generic
  216.      types are intended for use as the default type assigned when the
  217.      user connects to the system, with the intention that the user
  218.      should specify what type he really has.  One example of a generic
  219.      type is the type `network'.
  220.      Since the generic type cannot say how to do anything interesting
  221.      with the terminal, termcap-using programs will always find that the
  222.      terminal is too weak to be supported if the user has failed to
  223.      specify a real terminal type in place of the generic one.  The
  224.      `gn' flag directs these programs to use a different error message:
  225.      "You have not specified your real terminal type", rather than
  226.      "Your terminal is not powerful enough to be used".
  227.      Flag whose presence means this is a hardcopy terminal.
  228.      String of commands to output a graphic character C, repeated N
  229.      times.  The first parameter value is the ASCII code for the desired
  230.      character, and the second parameter is the number of times to
  231.      repeat the character.  Often this command requires padding
  232.      proportional to the number of times the character is repeated.
  233.      This effect can be had by using parameter arithmetic with
  234.      `%'-sequences to compute the amount of padding, then generating
  235.      the result as a number at the front of the string so that `tputs'
  236.      will treat it as padding.
  237.      Flag whose presence means that the ASCII character `~' cannot be
  238.      output on this terminal because it is used for display commands.
  239.      Programs handle this flag by checking all text to be output and
  240.      replacing each `~' with some other character(s).  If this is not
  241.      done, the screen will be thoroughly garbled.
  242.      The old Hazeltine terminals that required such treatment are
  243.      probably very rare today, so you might as well not bother to
  244.      support this flag.
  245.      String whose presence means the terminal has a settable command
  246.      character.  The value of the string is the default command
  247.      character (which is usually ESC).
  248.      All the strings of commands in the terminal description should be
  249.      written to use the default command character.  If you are writing
  250.      an application program that changes the command character, use the
  251.      `CC' capability to figure out how to translate all the display
  252.      commands to work with the new command character.
  253.      Most programs have no reason to look at the `CC' capability.
  254.      Flag whose presence identifies Superbee terminals which are unable
  255.      to transmit the characters ESC and `Control-C'.  Programs which
  256.      support this flag are supposed to check the input for the code
  257.      sequences sent by the F1 and F2 keys, and pretend that ESC or
  258.      `Control-C' (respectively) had been read.  But this flag is
  259.      obsolete, and not worth supporting.
  260. File: termcap.info,  Node: Screen Size,  Next: Cursor Motion,  Prev: Basic,  Up: Capabilities
  261. Screen Size
  262. ===========
  263.    A terminal description has two capabilities, `co' and `li', that
  264. describe the screen size in columns and lines.  But there is more to
  265. the question of screen size than this.
  266.    On some operating systems the "screen" is really a window and the
  267. effective width can vary.  On some of these systems, `tgetnum' uses the
  268. actual width of the window to decide what value to return for the `co'
  269. capability, overriding what is actually written in the terminal
  270. description.  On other systems, it is up to the application program to
  271. check the actual window width using a system call.  For example, on BSD
  272. 4.3 systems, the system call `ioctl' with code `TIOCGWINSZ' will tell
  273. you the current screen size.
  274.    On all window systems, termcap is powerless to advise the application
  275. program if the user resizes the window.  Application programs must deal
  276. with this possibility in a system-dependent fashion.  On some systems
  277. the C shell handles part of the problem by detecting changes in window
  278. size and setting the `TERMCAP' environment variable appropriately.
  279. This takes care of application programs that are started subsequently.
  280. It does not help application programs already running.
  281.    On some systems, including BSD 4.3, all programs using a terminal get
  282. a signal named `SIGWINCH' whenever the screen size changes.  Programs
  283. that use termcap should handle this signal by using `ioctl TIOCGWINSZ'
  284. to learn the new screen size.
  285.      Numeric value, the width of the screen in character positions.
  286.      Even hardcopy terminals normally have a `co' capability.
  287.      Numeric value, the height of the screen in lines.
  288. File: termcap.info,  Node: Cursor Motion,  Next: Wrapping,  Prev: Screen Size,  Up: Capabilities
  289. Cursor Motion
  290. =============
  291.    Termcap assumes that the terminal has a "cursor", a spot on the
  292. screen where a visible mark is displayed, and that most display
  293. commands take effect at the position of the cursor.  It follows that
  294. moving the cursor to a specified location is very important.
  295.    There are many terminal capabilities for different cursor motion
  296. operations.  A terminal description should define as many as possible,
  297. but most programs do not need to use most of them.  One capability,
  298. `cm', moves the cursor to an arbitrary place on the screen; this by
  299. itself is sufficient for any application as long as there is no need to
  300. support hardcopy terminals or certain old, weak displays that have only
  301. relative motion commands.  Use of other cursor motion capabilities is an
  302. optimization, enabling the program to output fewer characters in some
  303. common cases.
  304.    If you plan to use the relative cursor motion commands in an
  305. application program, you must know what the starting cursor position
  306. is.  To do this, you must keep track of the cursor position and update
  307. the records each time anything is output to the terminal, including
  308. graphic characters.  In addition, it is necessary to know whether the
  309. terminal wraps after writing in the rightmost column.  *Note Wrapping::.
  310.    One other motion capability needs special mention: `nw' moves the
  311. cursor to the beginning of the following line, perhaps clearing all the
  312. starting line after the cursor, or perhaps not clearing at all.  This
  313. capability is a least common denominator that is probably supported
  314. even by terminals that cannot do most other things such as `cm' or `do'.
  315. Even hardcopy terminals can support `nw'.
  316.      String of commands to position the cursor at line L, column C.
  317.      Both parameters are origin-zero, and are defined relative to the
  318.      screen, not relative to display memory.
  319.      All display terminals except a few very obsolete ones support `cm',
  320.      so it is acceptable for an application program to refuse to
  321.      operate on terminals lacking `cm'.
  322.      String of commands to move the cursor to the upper left corner of
  323.      the screen (this position is called the "home position").  In
  324.      terminals where the upper left corner of the screen is not the
  325.      same as the beginning of display memory, this command must go to
  326.      the upper left corner of the screen, not the beginning of display
  327.      memory.
  328.      Every display terminal supports this capability, and many
  329.      application programs refuse to operate if the `ho' capability is
  330.      missing.
  331.      String of commands to move the cursor to the lower left corner of
  332.      the screen.  On some terminals, moving up from home position does
  333.      this, but programs should never assume that will work.  Just
  334.      output the `ll' string (if it is provided); if moving to home
  335.      position and then moving up is the best way to get there, the `ll'
  336.      command will do that.
  337.      String of commands to move the cursor to the beginning of the line
  338.      it is on.  If this capability is not specified, many programs
  339.      assume they can use the ASCII carriage return character for this.
  340.      String of commands to move the cursor left one column.  Unless the
  341.      `bw' flag capability is specified, the effect is undefined if the
  342.      cursor is at the left margin; do not use this command there.  If
  343.      `bw' is present, this command may be used at the left margin, and
  344.      it wraps the cursor to the last column of the preceding line.
  345.      String of commands to move the cursor right one column.  The
  346.      effect is undefined if the cursor is at the right margin; do not
  347.      use this command there, not even if `am' is present.
  348.      String of commands to move the cursor vertically up one line.  The
  349.      effect of sending this string when on the top line is undefined;
  350.      programs should never use it that way.
  351.      String of commands to move the cursor vertically down one line.
  352.      The effect of sending this string when on the bottom line is
  353.      undefined; programs should never use it that way.
  354.      Some programs do use `do' to scroll up one line if used at the
  355.      bottom line, if `sf' is not defined but `sr' is.  This is only to
  356.      compensate for certain old, incorrect terminal descriptions.  (In
  357.      principle this might actually lead to incorrect behavior on other
  358.      terminals, but that seems to happen rarely if ever.)  But the
  359.      proper solution is that the terminal description should define
  360.      `sf' as well as `do' if the command is suitable for scrolling.
  361.      The original idea was that this string would not contain a newline
  362.      character and therefore could be used without disabling the
  363.      kernel's usual habit of converting of newline into a
  364.      carriage-return newline sequence.  But many terminal descriptions
  365.      do use newline in the `do' string, so this is not possible; a
  366.      program which sends the `do' string must disable output conversion
  367.      in the kernel (*note Initialize::.).
  368.      Flag whose presence says that `le' may be used in column zero to
  369.      move to the last column of the preceding line.  If this flag is
  370.      not present, `le' should not be used in column zero.
  371.      String of commands to move the cursor to start of next line,
  372.      possibly clearing rest of line (following the cursor) before
  373.      moving.
  374. `DO', `UP', `LE', `RI'
  375.      Strings of commands to move the cursor N lines down vertically, up
  376.      vertically, or N columns left or right.  Do not attempt to move
  377.      past any edge of the screen with these commands; the effect of
  378.      trying that is undefined.  Only a few terminal descriptions provide
  379.      these commands, and most programs do not use them.
  380.      String of commands to position the cursor at line L, column C,
  381.      relative to display memory.  Both parameters are origin-zero.
  382.      This capability is present only in terminals where there is a
  383.      difference between screen-relative and memory-relative addressing,
  384.      and not even in all such terminals.
  385.      String of commands to position the cursor at column C in the same
  386.      line it is on.  This is a special case of `cm' in which the
  387.      vertical position is not changed.  The `ch' capability is provided
  388.      only when it is faster to output than `cm' would be in this
  389.      special case.  Programs should not assume most display terminals
  390.      have `ch'.
  391.      String of commands to position the cursor at line L in the same
  392.      column.  This is a special case of `cm' in which the horizontal
  393.      position is not changed.  The `cv' capability is provided only
  394.      when it is faster to output than `cm' would be in this special
  395.      case.  Programs should not assume most display terminals have `cv'.
  396.      String of commands to make the terminal save the current cursor
  397.      position.  Only the last saved position can be used.  If this
  398.      capability is present, `rc' should be provided also.  Most
  399.      terminals have neither.
  400.      String of commands to make the terminal restore the last saved
  401.      cursor position.  If this capability is present, `sc' should be
  402.      provided also.  Most terminals have neither.
  403.      String of commands to advance to the next page, for a hardcopy
  404.      terminal.
  405.      String of commands to move the cursor right to the next hardware
  406.      tab stop column.  Missing if the terminal does not have any kind of
  407.      hardware tabs.  Do not send this command if the kernel's terminal
  408.      modes say that the kernel is expanding tabs into spaces.
  409.      String of commands to move the cursor left to the previous hardware
  410.      tab stop column.  Missing if the terminal has no such ability; many
  411.      terminals do not.  Do not send this command if the kernel's
  412.      terminal modes say that the kernel is expanding tabs into spaces.
  413.    The following obsolete capabilities should be included in terminal
  414. descriptions when appropriate, but should not be looked at by new
  415. programs.
  416.      Flag whose presence means the terminal does not support the ASCII
  417.      carriage return character as `cr'.  This flag is needed because
  418.      old programs assume, when the `cr' capability is missing, that
  419.      ASCII carriage return can be used for the purpose.  We use `nc' to
  420.      tell the old programs that carriage return may not be used.
  421.      New programs should not assume any default for `cr', so they need
  422.      not look at `nc'.  However, descriptions should contain `nc'
  423.      whenever they do not contain `cr'.
  424.      Flag whose presence means that the ASCII tab character may not be
  425.      used for cursor motion.  This flag exists because old programs
  426.      assume, when the `ta' capability is missing, that ASCII tab can be
  427.      used for the purpose.  We use `xt' to tell the old programs not to
  428.      use tab.
  429.      New programs should not assume any default for `ta', so they need
  430.      not look at `xt' in connection with cursor motion.  Note that `xt'
  431.      also has implications for standout mode (*note Standout::.).  It
  432.      is obsolete in regard to cursor motion but not in regard to
  433.      standout.
  434.      In fact, `xt' means that the terminal is a Teleray 1061.
  435.      Very obsolete alternative name for the `le' capability.
  436.      Flag whose presence means that the ASCII character backspace may be
  437.      used to move the cursor left.  Obsolete; look at `le' instead.
  438.      Obsolete capability which is a string that can either be used to
  439.      move the cursor down or to scroll.  The same string must scroll
  440.      when used on the bottom line and move the cursor when used on any
  441.      other line.  New programs should use `do' or `sf', and ignore `nl'.
  442.      If there is no `nl' capability, some old programs assume they can
  443.      use the newline character for this purpose.  These programs follow
  444.      a bad practice, but because they exist, it is still desirable to
  445.      define the `nl' capability in a terminal description if the best
  446.      way to move down is *not* a newline.
  447. File: termcap.info,  Node: Wrapping,  Next: Scrolling,  Prev: Cursor Motion,  Up: Capabilities
  448. Wrapping
  449. ========
  450.    "Wrapping" means moving the cursor from the right margin to the left
  451. margin of the following line.  Some terminals wrap automatically when a
  452. graphic character is output in the last column, while others do not.
  453. Most application programs that use termcap need to know whether the
  454. terminal wraps.  There are two special flag capabilities to describe
  455. what the terminal does when a graphic character is output in the last
  456. column.
  457.      Flag whose presence means that writing a character in the last
  458.      column causes the cursor to wrap to the beginning of the next line.
  459.      If `am' is not present, writing in the last column leaves the
  460.      cursor at the place where the character was written.
  461.      Writing in the last column of the last line should be avoided on
  462.      terminals with `am', as it may or may not cause scrolling to occur
  463.      (*note Scrolling::.).  Scrolling is surely not what you would
  464.      intend.
  465.      If your program needs to check the `am' flag, then it also needs
  466.      to check the `xn' flag which indicates that wrapping happens in a
  467.      strange way.  Many common terminals have the `xn' flag.
  468.      Flag whose presence means that the cursor wraps in a strange way.
  469.      At least two distinct kinds of strange behavior are known; the
  470.      termcap data base does not contain anything to distinguish the two.
  471.      On Concept-100 terminals, output in the last column wraps the
  472.      cursor almost like an ordinary `am' terminal.  But if the next
  473.      thing output is a newline, it is ignored.
  474.      DEC VT-100 terminals (when the wrap switch is on) do a different
  475.      strange thing: the cursor wraps only if the next thing output is
  476.      another graphic character.  In fact, the wrap occurs when the
  477.      following graphic character is received by the terminal, before the
  478.      character is placed on the screen.
  479.      On both of these terminals, after writing in the last column a
  480.      following graphic character will be displayed in the first column
  481.      of the following line.  But the effect of relative cursor motion
  482.      characters such as newline or backspace at such a time depends on
  483.      the terminal.  The effect of erase or scrolling commands also
  484.      depends on the terminal.  You can't assume anything about what
  485.      they will do on a terminal that has `xn'.  So, to be safe, you
  486.      should never do these things at such a time on such a terminal.
  487.      To be sure of reliable results on a terminal which has the `xn'
  488.      flag, output a `cm' absolute positioning command after writing in
  489.      the last column.  Another safe thing to do is to output
  490.      carriage-return newline, which will leave the cursor at the
  491.      beginning of the following line.
  492. File: termcap.info,  Node: Scrolling,  Next: Windows,  Prev: Wrapping,  Up: Capabilities
  493. Scrolling
  494. =========
  495.    "Scrolling" means moving the contents of the screen up or down one or
  496. more lines.  Moving the contents up is "forward scrolling"; moving them
  497. down is "reverse scrolling".
  498.    Scrolling happens after each line of output during ordinary output
  499. on most display terminals.  But in an application program that uses
  500. termcap for random-access output, scrolling happens only when
  501. explicitly requested with the commands in this section.
  502.    Some terminals have a "scroll region" feature.  This lets you limit
  503. the effect of scrolling to a specified range of lines.  Lines outside
  504. the range are unaffected when scrolling happens.  The scroll region
  505. feature is available if either `cs' or `cS' is present.
  506.      String of commands to scroll the screen one line up, assuming it is
  507.      output with the cursor at the beginning of the bottom line.
  508.      String of commands to scroll the screen one line down, assuming it
  509.      is output with the cursor at the beginning of the top line.
  510.      A few programs will try to use `do' to do the work of `sf'.  This
  511.      is not really correct--it is an attempt to compensate for the
  512.      absence of a `sf' command in some old terminal descriptions.
  513.      Since these terminal descriptions do define `sr', perhaps at one
  514.      time the definition of `do' was different and it could be used for
  515.      scrolling as well.  But it isn't desirable to combine these two
  516.      functions in one capability, since scrolling often requires more
  517.      padding than simply moving the cursor down.  Defining `sf' and
  518.      `do' separately allows you to specify the padding properly.  Also,
  519.      all sources agree that `do' should not be relied on to do
  520.      scrolling.
  521.      So the best approach is to add `sf' capabilities to the
  522.      descriptions of these terminals, copying the definition of `do' if
  523.      that does scroll.
  524.      String of commands to scroll the screen N lines up, assuming it is
  525.      output with the cursor at the beginning of the bottom line.
  526.      String of commands to scroll the screen N lines down, assuming it
  527.      is output with the cursor at the beginning of the top line.
  528.      String of commands to set the scroll region.  This command takes
  529.      two parameters, START and END, which are the line numbers
  530.      (origin-zero) of the first line to include in the scroll region
  531.      and of the last line to include in it.  When a scroll region is
  532.      set, scrolling is limited to the specified range of lines; lines
  533.      outside the range are not affected by scroll commands.
  534.      Do not try to move the cursor outside the scroll region.  The
  535.      region remains set until explicitly removed.  To remove the scroll
  536.      region, use another `cs' command specifying the full height of the
  537.      screen.
  538.      The cursor position is undefined after the `cs' command is set, so
  539.      position the cursor with `cm' immediately afterward.
  540.      String of commands to set the scroll region using parameters in
  541.      different form.  The effect is the same as if `cs' were used.
  542.      Four parameters are required:
  543.        1. Total number of lines on the screen.
  544.        2. Number of lines above desired scroll region.
  545.        3. Number of lines below (outside of) desired scroll region.
  546.        4. Total number of lines on the screen, the same as the first
  547.           parameter.
  548.      This capability is a GNU extension that was invented to allow the
  549.      Ann Arbor Ambassador's scroll-region command to be described; it
  550.      could also be done by putting non-Unix `%'-sequences into a `cs'
  551.      string, but that would have confused Unix programs that used the
  552.      `cs' capability with the Unix termcap.  Currently only GNU Emacs
  553.      uses the `cS' capability.
  554.      Flag which means that the terminal does not normally scroll for
  555.      ordinary sequential output.  For modern terminals, this means that
  556.      outputting a newline in ordinary sequential output with the cursor
  557.      on the bottom line wraps to the top line.  For some obsolete
  558.      terminals, other things may happen.
  559.      The terminal may be able to scroll even if it does not normally do
  560.      so.  If the `sf' capability is provided, it can be used for
  561.      scrolling regardless of `ns'.
  562.      Flag whose presence means that lines scrolled up off the top of the
  563.      screen may come back if scrolling down is done subsequently.
  564.      The `da' and `db' flags do not, strictly speaking, affect how to
  565.      scroll.  But programs that scroll usually need to clear the lines
  566.      scrolled onto the screen, if these flags are present.
  567.      Flag whose presence means that lines scrolled down off the bottom
  568.      of the screen may come back if scrolling up is done subsequently.
  569.      Numeric value, the number of lines of display memory that the
  570.      terminal has.  A value of zero means that the terminal has more
  571.      display memory than can fit on the screen, but no fixed number of
  572.      lines.  (The number of lines may depend on the amount of text in
  573.      each line.)
  574.    Any terminal description that defines `SF' should also define `sf';
  575. likewise for `SR' and `sr'.  However, many terminals can only scroll by
  576. one line at a time, so it is common to find `sf' and not `SF', or `sr'
  577. without `SR'.
  578.    Therefore, all programs that use the scrolling facilities should be
  579. prepared to work with `sf' in the case that `SF' is absent, and
  580. likewise with `sr'.  On the other hand, an application program that
  581. uses only `sf' and not `SF' is acceptable, though slow on some
  582. terminals.
  583.    When outputting a scroll command with `tputs', the NLINES argument
  584. should be the total number of lines in the portion of the screen being
  585. scrolled.  Very often these commands require padding proportional to
  586. this number of lines.  *Note Padding::.
  587. File: termcap.info,  Node: Windows,  Next: Clearing,  Prev: Scrolling,  Up: Capabilities
  588. Windows
  589. =======
  590.    A "window", in termcap, is a rectangular portion of the screen to
  591. which all display operations are restricted.  Wrapping, clearing,
  592. scrolling, insertion and deletion all operate as if the specified
  593. window were all the screen there was.
  594.      String of commands to set the terminal output screen window.  This
  595.      string requires four parameters, all origin-zero:
  596.        1. The first line to include in the window.
  597.        2. The last line to include in the window.
  598.        3. The first column to include in the window.
  599.        4. The last column to include in the window.
  600.    Most terminals do not support windows.
  601. File: termcap.info,  Node: Clearing,  Next: Insdel Line,  Prev: Windows,  Up: Capabilities
  602. Clearing Parts of the Screen
  603. ============================
  604.    There are several terminal capabilities for clearing parts of the
  605. screen to blank.  All display terminals support the `cl' string, and
  606. most display terminals support all of these capabilities.
  607.      String of commands to clear the entire screen and position the
  608.      cursor at the upper left corner.
  609.      String of commands to clear the line the cursor is on, and all the
  610.      lines below it, down to the bottom of the screen.  This command
  611.      string should be used only with the cursor in column zero; their
  612.      effect is undefined if the cursor is elsewhere.
  613.      String of commands to clear from the cursor to the end of the
  614.      current line.
  615.      String of commands to clear N characters, starting with the
  616.      character that the cursor is on.  This command string is expected
  617.      to leave the cursor position unchanged.  The parameter N should
  618.      never be large enough to reach past the right margin; the effect
  619.      of such a large parameter would be undefined.
  620.    Clear to end of line (`ce') is extremely important in programs that
  621. maintain an updating display.  Nearly all display terminals support this
  622. operation, so it is acceptable for a an application program to refuse to
  623. work if `ce' is not present.  However, if you do not want this
  624. limitation, you can accomplish clearing to end of line by outputting
  625. spaces until you reach the right margin.  In order to do this, you must
  626. know the current horizontal position.  Also, this technique assumes
  627. that writing a space will erase.  But this happens to be true on all
  628. the display terminals that fail to support `ce'.
  629. File: termcap.info,  Node: Insdel Line,  Next: Insdel Char,  Prev: Clearing,  Up: Capabilities
  630. Insert/Delete Line
  631. ==================
  632.    "Inserting a line" means creating a blank line in the middle of the
  633. screen, and pushing the existing lines of text apart.  In fact, the
  634. lines above the insertion point do not change, while the lines below
  635. move down, and one is normally lost at the bottom of the screen.
  636.    "Deleting a line" means causing the line to disappear from the
  637. screen, closing up the gap by moving the lines below it upward.  A new
  638. line appears at the bottom of the screen.  Usually this line is blank,
  639. but on terminals with the `db' flag it may be a line previously moved
  640. off the screen bottom by scrolling or line insertion.
  641.    Insertion and deletion of lines is useful in programs that maintain
  642. an updating display some parts of which may get longer or shorter.
  643. They are also useful in editors for scrolling parts of the screen, and
  644. for redisplaying after lines of text are killed or inserted.
  645.    Many terminals provide commands to insert or delete a single line at
  646. the cursor position.  Some provide the ability to insert or delete
  647. several lines with one command, using the number of lines to insert or
  648. delete as a parameter.  Always move the cursor to column zero before
  649. using any of these commands.
  650.      String of commands to insert a blank line before the line the
  651.      cursor is on.  The existing line, and all lines below it, are
  652.      moved down.  The last line in the screen (or in the scroll region,
  653.      if one is set) disappears and in most circumstances is discarded.
  654.      It may not be discarded if the `db' is present (*note
  655.      Scrolling::.).
  656.      The cursor must be at the left margin before this command is used.
  657.      This command does not move the cursor.
  658.      String of commands to delete the line the cursor is on.  The
  659.      following lines move up, and a blank line appears at the bottom of
  660.      the screen (or bottom of the scroll region).  If the terminal has
  661.      the `db' flag, a nonblank line previously pushed off the screen
  662.      bottom may reappear at the bottom.
  663.      The cursor must be at the left margin before this command is used.
  664.      This command does not move the cursor.
  665.      String of commands to insert N blank lines before the line that
  666.      the cursor is on.  It is like `al' repeated N times, except that
  667.      it is as fast as one `al'.
  668.      String of commands to delete N lines starting with the line that
  669.      the cursor is on.  It is like `dl' repeated N times, except that
  670.      it is as fast as one `dl'.
  671.    Any terminal description that defines `AL' should also define `al';
  672. likewise for `DL' and `dl'.  However, many terminals can only insert or
  673. delete one line at a time, so it is common to find `al' and not `AL',
  674. or `dl' without `DL'.
  675.    Therefore, all programs that use the insert and delete facilities
  676. should be prepared to work with `al' in the case that `AL' is absent,
  677. and likewise with `dl'.  On the other hand, it is acceptable to write
  678. an application that uses only `al' and `dl' and does not look for `AL'
  679. or `DL' at all.
  680.    If a terminal does not support line insertion and deletion directly,
  681. but does support a scroll region, the effect of insertion and deletion
  682. can be obtained with scrolling.  However, it is up to the individual
  683. user program to check for this possibility and use the scrolling
  684. commands to get the desired result.  It is fairly important to implement
  685. this alternate strategy, since it is the only way to get the effect of
  686. line insertion and deletion on the popular VT100 terminal.
  687.    Insertion and deletion of lines is affected by the scroll region on
  688. terminals that have a settable scroll region.  This is useful when it is
  689. desirable to move any few consecutive lines up or down by a few lines.
  690. *Note Scrolling::.
  691.    The line pushed off the bottom of the screen is not lost if the
  692. terminal has the `db' flag capability; instead, it is pushed into
  693. display memory that does not appear on the screen.  This is the same
  694. thing that happens when scrolling pushes a line off the bottom of the
  695. screen.  Either reverse scrolling or deletion of a line can bring the
  696. apparently lost line back onto the bottom of the screen.  If the
  697. terminal has the scroll region feature as well as `db', the pushed-out
  698. line really is lost if a scroll region is in effect.
  699.    When outputting an insert or delete command with `tputs', the NLINES
  700. argument should be the total number of lines from the cursor to the
  701. bottom of the screen (or scroll region).  Very often these commands
  702. require padding proportional to this number of lines.  *Note Padding::.
  703.    For `AL' and `DL' the NLINES argument should *not* depend on the
  704. number of lines inserted or deleted; only the total number of lines
  705. affected.  This is because it is just as fast to insert two or N lines
  706. with `AL' as to insert one line with `al'.
  707.